<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>

    <style>
        #showDiv{
            width: 200px;
            height: 200px;
            border: 1px solid red;
            text-align: center;
            line-height: 200px;
        }
    </style>
</head>
<body>
<a href="index.html">作业一</a>
<a href="index00.html">作业二</a>
<a href="index01.html">作业三</a>
<a href="index02.html">作业四</a>
<a href="index03.html">作业五</a>
<div id="showDiv">

</div>
<button id="startBtn" type="button" onclick="start()">开始</button>
<script>
    var names = ["彭万里","高大山","谢大海","马宏宇","林冲","黄强辉","章汉夫","长江","林君雄","平山","朱希亮","李四光","甘铁生","张飞","马继祖","程孝先","欧阳修","杨万里"];
    //创建定时器对象
    var timer = null;

    //启动
    function start(){
        timer = window.setInterval(function(){
            var showDiv = document.getElementById("showDiv");
            //随机产生0~names.length之间整数
            var index = Math.floor(Math.random() * names.length);
            var name = names[index];
            showDiv.innerHTML = name;
        },20);
        setInterval(function(){
            window.clearInterval(timer);
        },2000)
    }


</script>
</body>
</html>